home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / trueSpace 7.6 / tS761B8Std.exe / {app} / Scripts / MaterialEditor / BricksHidden / SpotPS_2Shadow.Brick.xml < prev    next >
Extensible Markup Language  |  2008-06-10  |  2KB  |  29 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <ME_BRICK GUID="{A9B783AD-7E48-42D3-AA55-EAAEDC3DC8C6}" Name="RtUSpotlightPS2Shadow" GUIName="ShadowSpotlight-Pixel2" Description="Shadow casting Spotlight pixel 2 shader part">
  3.     <ME_BRICK_INPUTPARAM GUID="{736E38C7-3F55-4175-ACA1-E8EBB62F2234}" Name="SpotTexture" Type="RtSampler2D"/>
  4.     <ME_BRICK_INPUTPARAM GUID="{27824DB3-1DCD-423C-87A5-0F3021AB934E}" Name="ColorTone" Type="RtFloat4"/>
  5.     <ME_BRICK_INPUTPARAM GUID="{3FCA9185-9C4F-4A17-86F5-F9495773D802}" Name="VSLightColor" Type="RtFloat4"/>
  6.     <ME_BRICK_INPUTPARAM GUID="{80055FE2-56CC-4DB2-A856-0D2F7E81ACEE}" Name="VSLightDir" Type="RtFloat3"/>
  7.     <ME_BRICK_INPUTPARAM GUID="{6A990850-6051-4E53-B328-439DAB04FD88}" Name="TargetVector" Type="RtFloat3"/>
  8.     <ME_BRICK_INPUTPARAM GUID="{D733ECE3-ACE3-4B08-BD3F-1A7F2E3F0109}" Name="MaxAngle" Type="RtFloat"/>
  9.     <ME_BRICK_INPUTPARAM GUID="{B18421F3-93B9-4D2E-9E62-B3EC13F6240F}" Name="DepthTexture" Type="RtSampler2D"/>
  10.     <ME_BRICK_INPUTPARAM GUID="{9E79E93A-1C04-4613-A7CF-9DC85CE6E711}" Name="PixelPosition" Type="RtFloat4"/>
  11.     <ME_BRICK_OUTPUTPARAM GUID="{3607AF70-24F7-4243-AAC7-D449B6A101C2}" Name="LightColor" Type="RtFloat4"/>
  12.     <ME_BRICK_CODE><![CDATA[
  13.     //The spotlight PS method
  14.     void RtUSpotlightPS2Shadow(in RtSampler2D SpotTexture, in RtFloat4 ColorTone, in RtFloat4 VSLightColor,  
  15.                                in RtFloat3 VSLightDir, in RtFloat3 TargetVector, in RtFloat MaxAngle,
  16.                                in RtSampler2D DepthTexture, in RtFloat4 PixelPosition,
  17.                                out RtFloat4 LightColor)
  18.     {
  19.         float fDot = rtx_Dot(rtx_CubeNormalize(-VSLightDir), TargetVector);
  20.         float4 vProjector = (fDot>=MaxAngle) ? rtx_Tex2DProj(SpotTexture, VSLightColor) * ColorTone : float4(0,0,0,0);
  21.         float fCurrDepth = VSLightColor.z / VSLightColor.w;
  22.         float4 vShadow = rtx_Tex2DProj(DepthTexture, VSLightColor);
  23.         float4 vTmp = float4(1.0f, 1.0f/256.0f, 1.0f/256.0f/256.0f, 1.0f/256.0f);
  24.         float fMapDepth = rtx_Dot(vShadow, vTmp);       //A clever way to sum four numbers
  25.         LightColor = (fCurrDepth < fMapDepth) ? vProjector : float4(0,0,0,0);
  26.     }
  27.     ]]></ME_BRICK_CODE>
  28. </ME_BRICK>
  29.